home *** CD-ROM | disk | FTP | other *** search
- /* WIDE AREA INFORMATION SERVER SOFTWARE
- No guarantees or restrictions. See the readme file for the full standard
- disclaimer.
- 4.14.90 Harry Morris, morris@think.com
- */
-
- /*----------------------------------------------------------------------*/
- /* stubs for silly non-ansi c compilers */
- /*----------------------------------------------------------------------*/
-
- #include "ustubs.h"
- #include "cutil.h" /* for substrcmp and NULL */
-
-
-
- /*----------------------------------------------------------------------*/
- /* believe it or not, HP does not have bzero or bcopy */
-
- #ifdef hpux
-
- void bzero(ptr, len)
- char *ptr;
- int len;
- {
- long count;
- for (count = 0; count < len; count++){
- *(char*)(ptr + count) = 0;
- }
- }
-
- char *bcopy(src, dest, len)
- char *dest, *src;
- int len;
- {
- return((char*)memmove(dest, src, len));
- }
-
- char *getwd(pathname)
- char *pathname;
- {
- return(getcwd(pathname, MAX_FILENAME_LEN));
- }
-
- #endif
-
- #ifdef SYSV
- #include <prototypes.h> /* may be XENIX dependent! */
- char *
- getwd(pathname)
- char *pathname;
- {
- return(getcwd(pathname, MAX_FILENAME_LEN));
- }
- #endif /* def SYSV */
-
- /*----------------------------------------------------------------------*/
-
- #ifndef ANSI_LIKE /* memmove is an ANSI function not defined by K&R */
- #ifndef hpux /* but HP defines it */
- void*
- memmove(str1,str2,n)
- void* str1;
- void* str2;
- size_t n;
- {
- #ifdef M_XENIX
- memcpy((char*)str2,(char*)str1,(long)n); /* hope it works! */
- #else /* ndef M_XENIX */
- bcopy((char*)str2,(char*)str1,(long)n);
- #endif /* ndef M_XENIX */
- return(str1);
- }
- #endif /* ndef hpux */
-
- #else /* ansi is defined */
-
- #ifdef __GNUC__ /* we are ansi like, are we gcc */
-
- #ifndef NeXT /* and we are not on a next ! */
-
- void*
- memmove(str1,str2,n)
- void* str1;
- void* str2;
- size_t n;
- {
- bcopy((char*)str2,(char*)str1,(long)n);
- return(str1);
- }
-
- #endif /* ndef NeXT */
-
- #endif /* __GNUC__ */
-
- #endif /* else ndef ANSI_LIKE */
-
- /*----------------------------------------------------------------------*/
-
- #ifndef ANSI_LIKE
-
- /* atoi is not defined k&r. copied from the book */
- long atol(s)
- char *s;
- {
- long i, n, sign;
- for(i=0; s[i]==' ' || s[i]== 'n' || s[i]=='t'; i++)
- ; /* skip white space */
- sign = 1;
- if (s[i] == '+' || s[i] == '-')
- sign = (s[i++]=='+') ? 1 : -1;
- for (n=0; s[i] >= '0' && s[i] <= '9'; i++)
- n= 10 * n + s[i] - '0';
- return(sign * n);
- }
-
- /*----------------------------------------------------------------------*/
-
- char *strstr(src,sub)
- char *src;
- char *sub;
- {
- /* this is a poor implementation until the ANSI version catches on */
- char *ptr;
- for(ptr = src; (long)ptr <= (long)src + strlen(src) - strlen(sub); ptr++){
- if(substrcmp(ptr, sub))
- return(ptr);
- }
- return(NULL);
- }
-
- /*----------------------------------------------------------------------*/
-
- int remove(filename)
- char *filename;
- {
- return(unlink(filename));
- }
-
- /*----------------------------------------------------------------------*/
-
- #endif /* ndef ANSI_LIKE */
-
-
-